Vision-based car counting for multi-story carparks

ABSTRACT

Method and apparatus for counting vehicles at entrances, exits and transition zones of multi-story carparks, including particularly where the ceiling heights can be just marginally higher than the tallest expected vehicle, with a view to determine the carpark occupancy at different carpark levels by counting passing vehicles using a vision-based car counting system without relying on viewing test patterns or employing a blocking beam scheme and yet tolerating vehicles transgressing partially or fully into the wrong lane of a two-lane two-way road while ignoring vehicles moving opposite to the expected direction. Without imposing additional constraints to ambient carpark illumination, the methodology copes with highly specular vehicle surfaces, ignores non-vehicular objects and detects moving cast shadow or highlight, and adapts to daily and seasonal scene changes, and yet estimates vehicle speed.

CROSS REFERENCE TO RELATED APPLICATIONS

This application claims the befit of U.S. Provisional Patent ApplicationNo. 61/192,525 filed Sep. 20, 2008, which is incorporated by referenceherein.

REFERENCES

-   Ming-Yee Chiu et al, “An Embedded Real-time Vision System for    24-hour Indoor/Outdoor”, Proceedings of the 17^(th) International    Conference on Pattern Recognition” (ICPR04), pp. 338-341.-   Andrea Prati et al, “Detecting moving shadows: algorithms and    evaluation”, IEEE Transactions on Pattern Analysis and Machine    Intelligence, vol. 25, No. 7, July 2003-   Stauffer et al, “Learning patterns of activity using real-time    tracking”. IEEE Transactions on, Pattern Analysis and Machine    Intelligence, vol. 22 No. 8, 2000.

FIELD OF INVENTION

The invention is related to the fields of image processing andindustrial vision in general and vision-based object counting inparticular.

BACKGROUND OF THE INVENTION

The present invention relates to automatic counting of passing vehiclesthrough the use of video cameras. Throughout this disclosure the wordsvehicle and car are used interchangeably and are intended to encompasscars as well as trucks of various classes expected in carparkfacilities.

Having a notion of occupancy at different levels and zones inmulti-story carparks is becoming increasingly desirable for variousreasons in many high traffic carparks such as those in airports, sportstadiums, city centers and major malls. Such information can in turn beused to direct drivers more efficiently to unsaturated levels and zonesand, in turn, contribute to the carpark throughput. Many other reasonssuch as fuel consumption, decreasing pollution, or avoiding traffic jamscan additionally be cited as benefits of routing drivers moreefficiently to empty parking spaces.

A salient characteristic of many multi-story carparks is low ceilingheights compared to the permissible vehicle height. A 7.5 ftstory-height where the maximum permissible vehicle height is close to 7ft is not unprecedented. This application presents many challenges whenit comes to isolating the imaged objects from the background and eachother—namely, establishing background, foreground and performing imagesegmentation as well as coping with moving cast shadow and highlightsand illumination changes among others.

Use of vision systems for car counting in general traffic and carparksis not unprecedented. For example, Ming-Yee Chiu et al, describe asystem entitled “An Embedded Real-time Vision System for 24-hourIndoor/Outdoor”, in the Proceedings of the 17^(th) InternationalConference on Pattern Recognition” (ICPR04), pp. 338-341. They deploytwo camera-test pattern pairs each for one direction, each dedicated tocounting cars and trucks in one direction of the two-way roadway. Insuch arrangement the camera is placed high up on one side of the roadwhile its pairing test pattern sits low, close to the ground on theopposite side of the road. They use the blocking light-beam principle totrigger car counting in the far lane. The test pattern is an elaborateblack-and-white radial LED. The test pattern and the far-side vehiclecan be obscured by a nearside vehicle particularly if the ceiling heightis insufficient, as is often the case in multi-story carparks. On thecontrary, the present invention does not depend on viewing a testpattern nor is it hampered by the presence of obscuring near-sidevehicles, to be expected in 2-way traffic, as each camera is concernedwith counting the nearside vehicle and further tolerates vehicletransgression fully or partially into the wrong lane.

The system relies only on grayscale imagery and does not exploit color.From an image processing view point, the methodology of the presentinvention makes the following contributions:

-   -   1) It introduces a novel pixel-based adaptive background model        that always yields a prevailing background, a necessity in the        processing sequence of the present invention. As a result, the        background model in essence remains unimodal, while supporting        two contending distributions at all time. This is markedly        different from a bimodal model in whose case much like any        multimodal background model all modes co-exist at all time.    -   2) The above is accompanied by a novel pixel updating scheme.    -   3) A pixel classification scheme that rests on an adaptive        intensity threshold is introduced for assigning the respective        pixel coordinate into background or foreground.    -   4) It resolves the critical step of image segmentation i.e.        isolating the passing vehicles—or in general objects—from the        background and each other in the spatiotemporal space only in        the directions of concern and only to the extent necessary, as        opposed to pursing it in a full-fledged manner in the spatial        space or spatiotemporal space, yet without resort to any        blocking beam scheme including use of test patterns to mark        separation of the passing objects; in effect it circumvents the        difficult problem of segmenting of objects that may appear to be        touching or overlapping;    -   5) It views the scene through a slit-like monitor zone—i.e. a        fraction of the entire image—and consequently reduces the        computational load significantly;    -   6) It does not impose any additional constrain to ambient        lighting of multi-story carparks including coping exposure to        sunlight;    -   7) It introduces two novel cast shadow/highlight detectors;    -   8) It introduces a multitude of motion detection and speed        estimation schemes.

OBJECTS AND SUMMARY OF THE INVENTION

A salient characteristic of many multi-story carparks is their lowceiling compared with the permissible vehicles heights. A 7.5 ftstory-height where the maximum permissible vehicle height is close to 7ft is not uncommon. Moreover, this application presents many challengesthat among others require coping with: highly specular vehicle surfaces,daily and seasonal changes of ambient illumination, moving cast shadowand highlight in general and from other vehicles, along with arequirement to discount non-vehicular objects including pedestrians.Additionally, there is often a requirement to estimate vehicle speed.

The present invention solves the floor (or zonal) occupancy levelproblem through counting vehicles as they transit across the zonalboundaries of multi-story carparks. The same solution also addresses theproblem of counting vehicles at entrances or exits of such carparks.

Each car counting unit comprises a video camera, a digitizer, a visionprocessor which in turn communicates its instantaneous result, namely aninstance of a vehicle count to the carpark server, responsible formaintaining the occupancy levels at granularity of its choice. Thesystem generic configuration may assume different forms, for example,the camera may be and IP network camera performing on-board digitizationand encoding and transmitting the encoded video stream through aninterne connection to the vision processor that may itself assumedifferent configuration ranging from a general purpose computers to aDSP-based controllers or controllers in general.

Each car counting unit is intended to count vehicles in a givendirection.

It is an object of the present invention to:

-   -   count passing cars in a given direction even when they partially        or fully transgress into the wrong lane of a two-way two-lane        road;    -   count cars without resort to test patterns or painting or        modifying the roadway including its appearance;    -   cope with the ambient lighting that is available in carparks        plus variations due to sunlight or reflection of sunlight from        stationary or moving surfaces including the target or adjacent        vehicles;    -   cope with moving cast shadow or highlight brought about by        moving vehicles in the adjacent lane or close by objects;    -   not count pedestrians and generally non-vehicular objects for        example a pram or suitcase;    -   not count vehicles traveling in the opposite direction;    -   estimate the length of the passing objects; and    -   estimate the speed of the passing vehicles.

BRIEF DESCRIPTION OF THE DRAWING

FIG. 1 shows, the generic composition of one possible vision-based carcounting system as intended in the present invention. It comprises avideo camera 11, a vision processor 10, which is connected via acommunication link 12 to the carpark central server through which itreports every instance of a passing vehicle in the direction of concernwhile ignoring those in the opposite direction as well as non-vehicularobjects. Ultimately, each count finds its way into the carpark database.The video camera may be analog or digital or a hybrid camera. When thecamera is analog, the vision processor acquires the image sequencethrough a digitizer 13 which in turn dumps the image data into theaddress space of the vision processor. The minimal system is a singlechannel system with each channel being identified with a video camera,as shown in the FIG. 1. A car counting system may support severalchannels with each channel handling car count in one direction.

FIG. 2A depicts the plan view of a 2-way roadway at a transition zone ofa multi-story carpark with vehicles passing simultaneously in bothdirection. The vertical lines 21 and 22 represent the extremities of thetwo-way roadway. The video camera 20, which is intended to monitor theentire width of the roadway, is sited at the ceiling just above orproximity of road side edge 21. The vertical dashed line 23 depicts avirtual line marking the middle of the two way roadway and hencedividing the road into a near lane and far lane with respect to thevideo camera 20. The arrow 24 represents a vehicle passing in thecounting direction while the arrow 25 represents a vehicle in thereverse direction, which should not affect the count as far as imagesacquired through video camera 20 is concerned.

FIG. 2B again depicts the plan view of the same 2-way roadway as in FIG.2A, but in this instance a single vehicle is shown that is progressingalong the expected (i.e. counting) direction while having transgressedinto the wrong lane. The scene is being monitored by the same side videocamera 20 as in FIG. 2A. The passing vehicle will still be counted,although in the wrong lane, as long as is not obscured or occluded byanother.

FIG. 3 illustrates the imaging geometry. It shows the camera frustum 31at the road plane and the rectangular strip (also referred to as therectangular monitor strip) 32, which constitutes the part of the scenethat matters. It is noteworthy that the camera located at 38 (i.e. pointC) is so aligned that one of the outer faces of the camera's pyramidalview volume 30, specified through vertices C, C1, C2 remainsperpendicular to the road surface. A right-handed Cartesian coordinatesystem is associated with the scene and its origin 39 is located closeto the road edge 21 where a perpendicular dropped from camera point 38meets the road plane—also shown as point Co. The X-axis of thisright-handed coordinate system runs across the width of the road whileits Y-axis runs parallel to the road while its Z-axis protrudes out ofthe road surface. It should be noted that the rectangle monitor strip issymmetric about the X-axis. The camera's retina 36 and its associatedimage 34 are also depicted in the figure. The image coordinate system,as shown in the figure, is a left-handed coordinate system with itsorigin at the top left-hand corner of the image 34. The figure shows thegeometry relating the scene to its image-assuming first order paraxialoptics. Moreover, it depicts the rectangular monitor zone 32 once imagedonto camera space 35. As evident from said depiction the rectangularmonitor zone 32 in object space is imaged as symmetric trapezoidhereafter referred to as the trapezoidal monitor zone 35 in image space.Asymmetric trapezoid has two parallel sides and two equal sides. Thedashed line 33 depicts the principal ray of the camera while point Cspecifies the camera location 38 in 3-space. The scene is imaged througha rectilinear lens. The lateral field of view 37 of the imaging systemis depicted as angle α.

FIG. 4A illustrates the plan view of the 2-sided road of FIGS. 1A and1B, the rectangular monitor strip 32 and the sliding aperture 45 withinsaid rectangular monitor strip. Moreover, it specifies the parameters,which define the size and placement of the rectangular monitor strip 32and the sliding aperture 42 within it. The figure further illustratessome of the parameters that are at user's disposal to configure themonitor zone and the sliding aperture within it: user defined road width41 in contrast to the actual road width 40; the rectangular monitorheight 44 which together with the aforementioned user specified monitorheight 44 define the extent of said monitor strip 32; the user definedmargin 45 parameter which affects the placement of said rectangularmonitor strip from the origin of the coordinate system 39; the slidingaperture width 43. The sliding aperture in the object space is arectangular window that slides from the camera end of said rectangularmonitor zone 32 to its far end at user-defined pace. FIG. 4A alsodepicts side camera 20, which monitors the scene.

FIG. 4B shows the rectangular monitor strip 32 along with its slidingaperture when mapped onto image space. As evident the rectangularmonitor strip in the object space is mapped as the trapezoidal monitorzone 35 in image space. The figure further depicts how instances of theobject space rectangular sliding apertures are mapped onto correspondingtrapezoids 46 in image space, and in turn how the expected trapezoidalapertures are approximated by their inscribed orthogonal rectangles 47.° The figure further shows another instance of the rectangular slidingaperture in object space after having been mapped onto image space firstas trapezoid and being approximated by its inscribed orthogonalrectangle 48.

FIG. 5 depicts the principal processing stages of the entire methodologyin context of a synoptic functional block diagram. In such depiction,generally, each functional block illustrated by a rectangle states thenature of action, or process, performed along with its temporalprecedence over it connecting blocks. When pertinent, the inputs andoutputs of the functional blocks are also specified through an arrowpointer. Functional blocks have generally been assigned an even numberwhile their resulting outputs, or inputs, are assigned an odd number.Use has also been made of a triangular block as comparator—see forexample 1414 and 1418 in FIG. 18. Use also has been made of switcheswhich flip to one or another side based on the result of the precedingfunctional block or a comparison operation, for example 822 and 824 inFIG. 8. Use also has been made of logical-AND symbol as in 1020 in FIG.10 which is intended to state both inputs must persist in order toproceed to the next step.

FIG. 6 depicts the steps involved in defining the monitor strip and itsmapping onto image space including instances of its sliding aperturewithin the mapped monitor strip as it progress from the camera end ofmonitor zone to its far end. 601 specifies the parameters whether systemrelated such as—the focal length or the camera height—and those definingthe size and the placement of the rectangular monitor strip.

FIG. 7A depicts the steps involved in directional gradient processingwhich ultimately yields the gradient orientation image. One of its byproducts is the vertical gradient image which in turn is used toconstruct a mask—namely a binary image—for later use in determining thevehicle direction of motion and estimating the vehicle speed. Thefunctional blocks of FIG. 7A are collectively viewed as “directionalgradient processing” and are referred to as such or equally as “step 7A”for ease of reference.

FIG. 7B depicts the steps of pixel-based background modeling and pixelclassification leading to derivation of the foreground image in thepresent invention. 710B illustrates a loop which depicts updating of thebackground model followed by classification for the pixel coordinate ofconcern into a foreground or a background pixel until the fate of allpixels are concluded. This depiction may suggest that such operation mayonly be carried out sequentially while the intention here is to conveythat the background modeling step 702B and its accompanying pixelclassification step 704B are invoked for all pixels independently asopposed to necessarily sequentially as such operation affords massiveparallelism.

FIG. 8 shows the functional block diagram of the aperture processing.822 and 824 signify two two-way switches which flip to one side based onthe preceding operation, namely the local aperture processing 800 in thecase of 822 and whether more apertures remain to be processed in thecase of 824.

FIG. 9 illustrates the states of the column sum processing along withthe permissible transitions in it in context of a state diagram. Circlesin this depiction represent state such as 1004 in FIG. 10 while curvedarrows represent inter-state and self transitions.

FIG. 9A illustrates the requisites for assuming a particular state aswell as operations performed in those states along with the conditionsto be met for various state transitions during column-sum processing.

FIG. 10 illustrates the states of the row-sum processing along with thepermissible transitions to/from those states.

FIG. 10A illustrates the requisites for assuming a particular state andthose for inter-state transitions in row-sum processing.

FIG. 11 shows the functional block diagram of the Point-WiseCoordinate-Insensitive Shadow or Highlight Detector, for ease ofreference hereafter also referred to as PWCISHD.

FIG. 12 shows the functional block diagram of Point-WiseCoordinate-Sensitive moving cast Shadow or Highlight Detector, for easeof reference hereafter also referred to as PWCSSHD.

FIG. 13 shows the steps in establishing the thresholds for use inidentifying the subset of points that make up the masks to be used forshift (displacement) computation between various image pairs.

FIG. 14 illustrates the steps of detecting the inter-frame shift(displacement) through a normalized correlation-based operation betweenthe smoothed images of the current and prior frames with theparticipating grayscales being pixel coordinates sanctioned by theiraccompanying masks.

FIG. 15 illustrates steps involved in computing the displacement betweenthe current and prior gradient orientation image pair along with theirrespective masks exhibiting maximum similarity

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

The present invention is described in context of several exemplaryembodiments.

Example Hardware

FIG. 1 shows the generic composition of a vision-based car countingsystem as intended in the present invention, however, for explanationpurposes the simplest and minimal configuration has been chosen, as willbecome apparent shortly. It comprises a video camera 11, a visionprocessor 10, which is connected via a communication link to the carparkcentral server 12 through which it reports every instance of a passingvehicle in the direction of concern while ignoring those in the oppositedirection. Ultimately, each count finds its way into the carparkdatabase 12. The video camera may be an analog, digital or a hybridcamera. When the camera is analog, the vision processor 10 as shown inFIG. 1 acquires the image sequence through a digitizer 13 which in turndumps the image data into the address space of the vision processor 10.The vision processor 10 may be realized through a central serversupporting one or a multitude of channels with each channel beingidentified with a video camera or more generally video feed as long asthe video is acquired through a camera that is retrofitted withappropriate optics and placed and posed to monitor its scene in acertain way- to be addressed. The vision processor 10 may equally berealized through an embedded video edge device, for example, with one ortwo channels. It will be apparent to one skilled in the art that thesupporting system, as described so far and depicted in FIG. 1, mayassume a variety of configurations without departing from the spirit andscope of the present invention.

FIG. 2A shows the plan view of a 2-way roadway at a transition zone of amulti-story carpark where the scene is being imaged by the same sidecamera 20 of FIG. 1A. The minimal car counting system hereafter alsoreferred to as a car counting unit is intended to count passing vehiclesin a tow-way two-lane roadway in the expected direction while ignoringthose in the opposite direction and ignoring all non-vehicular objects,for example, pedestrians in both directions.

FIG. 2B again shows the plan view of a 2-way roadway at a transitionzone of a multi-story carpark. Although, the vehicle is progressing inthe expected direction, however, it has transgressed into the wrong laneof the depicted two-way road. The scene is being monitored by the sameside camera 20, as shown in FIG. 2A. FIG. 2B is intended to reaffirmthat the car shall still be counted even when fully transgressed intothe wrong lane. The underlying assumption for the vehicle to be countedis that it must not be obscured or occluded by another. The system mustalso not count pedestrian and generally non-vehicular objects moving ineither direction.

FIG. 3 depicts the imaging geometry. It shows the camera frustum and therectangular strip, which constitutes the part of the scene that matters.It is noteworthy that one of the outer faces of the camera pyramidalview volume, specified through vertices C, C1, C2 must remainperpendicular to the road surface. A right-handed Cartesian coordinatesystem is associated with the scene. The origin is located close to theroad edge and the Y-axis runs parallel to the road. This figure showsthe geometry relating the scene and its image.

Monitored Zone and its Projection onto Image Space

The frustum of the camera at the plane of the road surface is depictedin FIG. 3. As evident from FIG. 3 and FIG. 4A, a rectangular region fromthe center of the road is designated as the zone to be monitored.

The imaging geometry of FIG. 3 causes the rectangular monitor strip tobe imaged as a trapezoid as depicted in FIG. 4B. Typically therectangular monitor strip stretches across the road-width. Therectangular monitor strip is monitored through a moving (sliding)rectangular window (aperture), which advances sequentially from thesensor end of the rectangular monitor strip across the monitor strip, ata user defined pace, to the far end of the rectangular monitor strip.

FIG. 4B shows the trapezoidal monitor zone of FIG. 4A along with itssliding aperture after being mapped onto image space. The figure furthershows how the expected trapezoidal sliding aperture in image space isapproximated by a sliding rectangular aperture. Instances of saidsliding image space rectangle or apertures are shown as 47 and 48.

FIG. 5 depicts the principal processing stages of the entire methodologyin context of a synoptic functional block diagram.

FIG. 6 illustrates the steps involved in defining the rectangularmonitor strip and its mapping onto the image space along with instancesof its sliding aperture. The input to this functional block diagramcomprises: 1) the height above road surface that camera is sited; 2) theroad width; 3) road margin—i.e. the horizontal distance from theperpendicular dropped from the camera to the road surface to the edge ofthe road; 4) Monitor strip height; 5) Monitor strip width; 6) slidingaperture width; 7) slide pace of the aperture; 8) focal length; and 9)the imager (retina) size.

Directional Gradient Processing

Referring to FIG. 7A, the gradient orientation image is computed, at theoutset, by convolving each smoothed image—be it the incident smoothedimage or the prevailing background, as shown in FIG. 7A—with the Sobelhorizontal 702A and vertical 704A kernels. The convention adopted ingradient direction is with the direction being perpendicular to the edgeitself and pointing from low to high gradient. Once the gradientmagnitude, for an entire image region encompassing the trapezoidalmonitor zone 613 is computed, it is subjected to a clip-low operation710A at an adaptive suppression threshold which is computed at step 708Aby:

-   -   1) Constructing a histogram of the gradient magnitude image, for        the region of interest;    -   2) Deriving a stable maximum for said histogram in (1), above,        by computing the median of the samples which fall within a top        predefined percentage of the population;    -   3) Deriving a trimmed mean for said histogram by ignoring a        bottom low and high top predefined percentages of the underlying        samples of the population;    -   4) Deriving a threshold from the mean of thus derived stable        maximum and trimmed mean in (2) and (3) above;    -   5) Selecting the greater of thus derived threshold in (4),        above, and a user-defined noise floor as suppression threshold        to be used in said clip low operation 710A.        All pixel coordinates be it background or in the incident frame        whose gradient magnitude have been suppressed in this manner        will remain deprived of gradient orientation and are flagged        accordingly 712A. The operation sequence thus described yields        the gradient orientation image 709A.        Background Modeling and Pixel Classification

Referring to step 7B in FIG. 5 and FIG. 7B, what is modeled is thetemporal sequence of grayscales at each pixel coordinate of the videostream. Each such sequence is modeled through two contending Gaussiandistributions. However, at any one time, only a single Gaussianprevails. The models are adaptive and one or the other is updated witharrival of each new frame, hence, permitting the pixel-based backgroundmodels to evolve in order to account for gradual changes in thebackground, which are inevitable due to lighting and other changes.

The two Gaussian distributions continually contend to represent thebackground. These models are viewed as the primary (or active orprevailing) model and the secondary (or contending or alternate) model.Each contending model shall at all times be lurking in the wings waitingfor an opportunity to replace its active counterpart. Such opportunityarises once the contending model can exhibit a smaller variance thanthat of the active model once it has iterated above a requisite minimum.Alternatively, such opportunity may also arise if the active model isfound not to have been replenished by a new sample beyond a giveninterval.

The object of background modeling is to reveal the foreground pixels,and is achieved in two steps: 1) background model updating 702B; and 2)pixel classification 704B. It should be remembered that all processing,at this stage, is confined to the “Trapezoidal Monitor Zone 5″ and itsimmediate periphery in Directional Gradient Processing 7A of FIG. 5”.

Updating the Background Model

Referring to step 702 of FIG. 7B, the background is attained throughrecursive computation of the mean and standard deviation of thegrayscale sequence at each pixel coordinates of the smoothed imagesequence—namely the raw image sequence after being low-pass filtered502, using a Gaussian Point Spread Function (PSF). The recursionformulas used are:

$µ_{n + 1} = {{\frac{n}{n + 1}µ_{n}} + {\frac{1}{n + 1}x_{n + 1}}}$$\sigma_{n + 1} = \sqrt{{\frac{n}{n + 1}\eta_{n}} + {\frac{1}{n + 1}y_{n + 1}} - ( {{\frac{n}{n + 1}µ_{n}} + {\frac{1}{n + 1}x_{n + 1}}} )^{2}}$wherex: grayscale of the pixel of concernμ: mean[x]σ: standard deviation of xn: number of iterationsy: x²η: mean[y]with

$\eta_{n + 1} = {{\frac{n}{n + 1}\eta_{n}} + {\frac{1}{n + 1}y_{n + 1}}}$

The incident pixel updates the primary background if it deviates from itby no more than an admissible extent defined through an adaptivethreshold. Said permissible deviation assumes different values based ongradient orientation differential, at a pixel coordinates, between thatof the incident frame and that of the background. More specifically,when the incident image point and the background point exhibitconformity in gradient orientation, then the threshold is relaxed—i.e.it becomes easier to surmount, otherwise if they exhibit a vastdifference then the threshold is made stringent—i.e. more difficult tomeet, and if neither exhibit a gradient direction then only a mild—i.e.moderate—discrepancy in grayscale is demanded of the pixel forcontributing to the background model. And all three levels in turn takeinto consideration the variance of background distribution at the pixelcoordinates of concern. In this scheme the following relation holds:relaxed<mild<stringent.

In the preferred embodiment, the primary background is made to havefaded memory through imposing a user-defined ceiling on the number ofsamples, n. This will give a somewhat higher weight to fresher samples.

Pixels in the incident smooth image that cannot update the primarybackground then update the contending, or alternate, background. Similarstatistics to the primary background are computed recursively for thealternate background.

Pixel Classification

Referring to Step 704B of FIG. 7B, The purpose of establishing anadaptive background model is to arrive at the foreground image—a binaryimage in which the foreground pixels are set and the background pixelsare cleared. Here again, much like updating the background model, anadaptive threshold is computed. When the gradient direction of thebackground and the incident smoothed image conform, then a so calledstringent, i.e. a relatively high intensity differential is demandedfrom the pixel to qualify as a foreground ground pixel. On the otherhand if the gradient orientations are sufficiently discrepant then arelaxed threshold applies—i.e. a much lower intensity differential isdemanded from the pixel. When either the incident frame or thebackground do not exhibit any gradient direction—by virtue of showinginsufficient gradient magnitude—then a so called mild threshold isapplied, i.e. a somewhat moderate intensity differential is expected atthat pixel coordinates for being assigned to foreground.

Again in this scheme relaxed<mild<stringent, and as before they are inturn derived from the variance of the prevailing background at therespective pixel coordinates.

Aperture Processing

Referring to step 8 in FIG. 5, aperture processing is where vehicles aredetected, discriminated from non-vehicular objects (for example,pedestrians), their conformity to expected direction of movement isconfirmed or negated and their speeds are estimated. Its significance isin enabling to circumvent the direct segmentation of foreground imagesequence. Aperture processing conducts image segmentation inspatiotemporal space—only to the extent required for isolating objectsfrom the background and from each other, yet it achieves it without theuse of beam blockage or disruption of the line of sight to a testpattern as in prior art, nor it imposes additional lighting constraintsto what is typically available in multi-story carparks. In short,through aperture processing the difficult problem of apparent touchingand overlapping objects at times encountered in machine vision iscircumvented.

As evident from FIG. 8 Aperture Processing is the final stage of thevehicle counting process. It concludes either by adding to the vehiclecount and resetting all apertures to start from a clean slate or onlyresetting, without incrementing the vehicle count, and starting from aclean slate for the respective instance of the slidingaperture—hereafter termed local aperture. FIG. 8 shows the principalstages of the Aperture Processing. Aperture processing itself rests onLocal Aperture Processing. Local apertures are instances of the slidingaperture in the rectangular monitor zone, i.e. in the object space, whenmapped onto image space and approximated by their inscribed rectangle,as depicted in 42 and 47, 48 in FIG. 4A and FIG. 4B. As evident fromFIG. 8, step 800—Local Aperture Processing—comprises its two mainconstituent processes: the Column-Sum processing 9, and the Row-Sumprocessing 10, followed by a Validation step 802. As depicted in FIG. 8,FIG. 9 and FIG. 10, during aperture processing, every instance of thesliding aperture is processed sequentially from left to right. Itshould, however, be noted that processing local apertures in sequencefrom left to right is a matter of convenience and can be pursuedrandomly.

As described earlier, local apertures are instances of sliding aperturesin object space after being mapped onto image space and approximated bytheir inscribed rectangle 47, 48.

Local Aperture Processing

Referring to functional block 800 of FIG. 8, in local apertureprocessing—the solidified foreground image within each thus derivedinscribed rectangle—i.e. each aperture—is viewed as a 0-1 matrix of mrows and n columns. Said 0-1 matrix is then decomposed into itsorthogonal projections, namely the row-sum vector R{right arrow over(S)} and the column-sum vector C{right arrow over (S)} whose definitionsappears below:

$\begin{matrix}{\overset{->}{RS} = \lbrack {{rs}_{1}\mspace{14mu}\ldots\mspace{14mu}{rs}_{m}} \rbrack^{\prime}} & (3)\end{matrix}$where [ ]′ signifies vector transpose and

${rs}_{i} = {\sum\limits_{j = 1}^{n}a_{ij}}$

$\begin{matrix}\begin{matrix}{\overset{->}{CS} = \lbrack {{cs}_{1}\mspace{14mu}\ldots\mspace{14mu}{cs}_{n}} \rbrack^{\prime}} \\{{{where}\mspace{14mu}{cs}_{j}} = {\sum\limits_{i = 1}^{m}a_{ij}}}\end{matrix} & (4)\end{matrix}$

As described later, both column-sum and row-sum processing need totransit through multiple states to conclude a vehicle count. Thecolumn-sum and row-sum processing progress in an intertwined manner.Transition from one state to another is only effected across frames,subject to additional provisos to be addressed. In the preferredembodiment, with the arrival of each frame, local apertures are scannedsequentially from closest to farthest from the camera. It is noteworthythat local apertures can be scanned and processed in different orderswithout departing from the methodology of the present invention.

It is emphasized here that viewing and processing the foreground imagein context of its projections has been pursued for its convenience andtractability and as apparent to any one skilled in the art theforeground image could have been processed directly and yet withoutdeparture from the methodology offered by the present invention. What issignificant in this respect is pursuing segmentation in context of thesliding aperture in spatiotemporal space only to the extent necessary.

Column-Sum Processing

Referring As a first step the column-sum vector is subjected to a noisesuppression operation, which entails suppressing elements that are lessthan a predefined percentage of the local aperture height. Noisesuppression, further suppresses isolated elements—irrespective of theirvalue—of the column sum vector. Isolated elements are those withadjacent 0-elements.

Column-sum processing is pursued in context of a multistate transitoryoperation, as shown in FIG. 9. The prime mover in bringing about statechanges is the fill ratio. There are, however, other factors that affectinter-state transition also, which remain to be addressed. Fill ratio isthe ratio of the sum of the elements of the column sum vector afternoise suppression to the number of pixels claimed by the respectiveaperture:

${{fill}\text{-}{ratio}_{cs}} = \frac{\sum\limits_{j = 1}^{n}\overset{\sim}{\;_{{cs}_{j}}}}{m.n}$with c{tilde over (s)}_(j)|J=1 . . . n denoting the noise suppressedelements of

$\overset{arrow}{CS}$m and n, above, denote the local aperture height and width in pixel.There are two user defined thresholds that qualify fill-ratios forvarious state transitions in the manner shown. The thresholds are, viz:1) (fr)_(lo); and 2) (fr)_(hi)The fill-ratio requirements for different states, in terms of abovethresholds, are delineated below.

$\begin{matrix}{{state} = \lbrack \begin{matrix}{{Clear}\mspace{14mu} 1} & {if} & {{{fill} - {ratio}} < ({fr})_{lo}} \\{Growing} & {if} & {({fr})_{lo} \leq {{fill} - {ratio}} \leq ({fr})_{hi}} \\{Full} & {if} & {{{fill} - {ratio}} > ({fr})_{hi}} \\{Growing} & {if} & {({fr})_{lo} \leq {{fill} - {ratio}} \leq ({fr})_{hi}} \\{{Clear}\mspace{14mu} 2} & {if} & {{{fill} - {ratio}} < ({fr})_{lo}}\end{matrix} } & (5)\end{matrix}$It is emphasized that there may be other conditions beyond thosespecified in (5), above, to effect a state transition as detailed inFIG. 9A.

Column-sum processing entails 6 states in total. FIG. 9 illustrates thepermissible state transitions during the column-sum processing. Once therequisites are met, the state transition is effected with the arrival ofthe subsequent video frame. Vehicle count cannot be incremented withoutcolumn-sum processing reaching its conclusive stage, i.e. the Finalstate. Even then, row-sum processing must also conclude satisfactorilyfor the vehicle count to be incremented. As illustrated in FIG. 9 it isimperative that column-sum processing transit at least through theClear1, Full and Clear2 states to conclude column-sum processing. Again,as evident from FIG. 9, other routes that additionally include visitingthe Growing and/or the Receding states also constitute viable routes forsatisfactory conclusion of column-sum processing needed to incrementvehicle count.

There are two attributes that are computed in the course of columnprocessing: 1) symmetry; and 2) direction—i.e. motion direction. Thefirst is intended to disqualify apertures that are not filledsymmetrically by the foreground pixels, while the second is concernedwith disqualifying a local aperture based on motion direction: moving inopposite direction disqualifies an object from being counted and iscause enough to lead to the resetting the associated aperture.

Symmetry

The purpose of computing symmetry is to conclude abruptly column-sumprocessing and thence reset the aperture in which the foreground pixels(observed through the associated column-sum vector) are not evenlydistributed across the width of the aperture, as the object advancesthrough the Growing, Full and Receding states. A vehicle by virtue ofits shape and size is expected to exhibit such symmetry at least withinone instance of the sliding aperture. To this end the followingattributes are computed:

$\begin{matrix}{{\text{left} - \text{sum}} = {\sum\limits_{i = 1}^{n/2}{cs}_{j}}} & {{\text{right} - \text{sum}} = {\sum\limits_{i = {\frac{n}{2} + 1}}^{n}{cs}_{j}}} \\{{\text{left} - \text{span}} = {\sum\limits_{i = 1}^{n/2}{{sgn}( {cs}_{j} )}}} & {{\text{right} - \text{span}} = {\sum\limits_{i = {\frac{n}{2} + 1}}^{n}{{sgn}( {cs}_{j} )}}}\end{matrix}$where sgn( ) represents the signum functionand in turn the following attributes are derived from them:

$\begin{matrix}{{\text{span} - \text{symmetry}} = \frac{2.{\min( {{\text{left} - \text{span}},{\text{right} - \text{span}}} )}}{\text{left} - \text{span} + \text{right} - \text{span}}} \\{{\text{sum} - \text{symmetry}} = \frac{2.\text{min}( {{\text{left} - \text{sum}},{\text{right} - \text{sum}}} )}{\text{left} - \text{sum} + \text{right} - \text{sum}}}\end{matrix}$and eventuallysymmetry=min(span-symmetry, sum-symmetry)

In the preferred embodiment a recursive mean is computed for thusdefined symmetry. This quantity is then gauged against a minimumacceptable threshold, and when not met a reset of the respectiveaperture is forced.

In yet another embodiments of the present invention symmetry is gaugedthrough span-symmetry much like sum-symmetry, individually as describedabove.

Symmetry, across the width of a local aperture, can be gauged throughother routes such as computing skewness However, it is understood thatit will be obvious to one skilled in the art that all such obviousmodifications are intended to be within the scope of the invention.

After a reset the column-sum process enters the Clear1 state. If thefill-ratio remains below a predefined low threshold the state willremain unchanged in the next frame. As shown in FIG. 9, this state canbe maintained as long as the fill-ratio does not dictate otherwise. Whenthe fill-ratio is above a high predefined threshold the state transitsto the Full state directly. When in Full state and the fill ratio is inbetween the two said thresholds, the destination state becomes eitherGrowing or Receding, based on the inferred underlying direction ofmotion. Namely, when motion direction is compatible with the expecteddirection of flow the state transits from Full to Growing, otherwise ittransits to the Receding state—See FIG. 9 and FIG. 9A for permissiblestate transitions and associated condition and critical operationsperformed.

Motion Direction Indicator

The motivation for establishing motion direction during column-sumprocessing is to disambiguate state transition from the Full state toeither Growing or Receding when the fill-ratio dictates it. Asillustrated in FIG. 9 the state is liable to transit either way: Growingor Receding.

Motion direction during column processing is pursued only at Growing andReceding states, and entails computation of a mean recursively. Theresult is used only in the Full state and only when the fill-ratioreduces to the point of requiring transition to either Growing orReceding state.

Column-sum motion direction or cs-direction is determined as follows:

${\text{lead} - {cs}} = {\sum\limits_{i = {m/2}}^{m}{rs}_{i}}$${\text{trail} - {cs}} = {\sum\limits_{i = 1}^{m/2}{rs}_{i}}$rs_(i) is as defined earlier.

${{cs}\text{-direction}} = \lbrack \begin{matrix}{{{1\mspace{14mu}{if}\mspace{14mu}\text{lead}} - {cs}} > {\text{tail} - {cs}}} \\{{- 1}\mspace{14mu}{else}}\end{matrix} $cs-direction is averaged recursively and when the resultant mean ispositive the Receding state will be the destination state as opposed tothe Growing state and vice-versa, when this attribute is examined whilein Full state and the associated fill-ratio descends requiring departurefrom the Full state. In this way the direction of state transition fromFull state to either Growing or Receding state is disambiguated.

In yet another embodiment of the present invention only examination ofcs-direction at Full state and subsequently when the fill-ratio descendsto warrant transition to either Growing or Receding state disambiguatesthe transition path.

FIG. 9A illustrates the requisite for assuming a particular state aswell as operations performed in those states along with the conditionsto be met for various state transitions.

Row-Sum Processing

Much like column processing, at the outset, the row-sum vector issubjected to a noise suppression operation, which suppresses elementsthat are less than a predefined percentage of the local aperture width.Noise suppression, further suppresses isolated elements of the row-sumvector.

Row-sum processing is pursued in context of a multistate transitoryoperation, as shown in FIG. 10. The prime mover in bringing about statechanges is the fill-ratio. There are, however, other factors that affectinter-state transition also, which remain to be addressed. fill-ratio isthe ratio of the sum of the elements of the row-sum vector after noisesuppression to the number of pixels claimed by the respective apertureas specified below:

${\text{fill} - \text{ratio}_{rs}} = \frac{\sum\limits_{i = 1}^{m}\overset{\sim}{{rs}_{i}}}{m.n}$with r{tilde over (s)}_(i)|i=1 . . . m denoting the noise suppressedelements of R{right arrow over (S)}The fill-ratio requirements for different states are similar to thosedelineated for column-sum processing earlier.As depicted in FIG. 10, row-sum processing begins with the Clear1 stateand ends at the Clear2 state where either the aperture resets orconcludes towards the Final state and eventually the validationstage-step 802 in FIG. 8. Successful validation increments the vehiclecount.

In the course of row-sum processing several attributes are computedwhich in conjunction with fill-ratio effect state transition. The objectof computing these attributes is to determine motion direction, enablingspeed estimation, and in turn preventing opposing vehicles andnon-vehicular objects from being counted. To this end, the followingattributes are computed: 1) shadow/highlight; 2) Motion

Shadow/Highlight

Stationary shadows/highlights are not of concern, as they get absorbedinto the adaptive background, as described earlier. But, moving castshadows/highlights need to be accounted for. To this end this inventionpresents two new shadow and highlight detectors. Both aregrayscale-based; one uses the divergence between two populations ofgradient orientation due to the incident frame and the prevailingbackground (i.e. two regions of interest) while the other exploits thedifference in gradient orientation between corresponding point pairs ofthose regions. For ease of reference they are referred to as:

-   -   1) A Point-Wise Coordinate Insensitive Shadow/Highlight Detector        (PWCISHD);    -   2) A Point-Wise Coordinate Sensitive Shadow/Highlight Detector        (PWCSSHD);        Both are only attempted when the fill-ratio qualifies for the        Full state during the row-sum processing. They both exploit the        texture of the underlying background to determine whether the        background in the local aperture is obscured by an object or        shadow/highlight.

Said shadow-highlight detectors can be used independently to yield averdict, but, in the preferred embodiment they are used jointly. Whenused jointly, one operates as the tiebreaker for the decision renderedby the other. The initial or the base detector assigns the incidentlocal aperture to either of three classes of shadow/highlight,uncertain, or obscured by object. The other detector breaks the tie ininstances when an uncertain verdict is rendered by said base detector.

PWCISHD

FIG. 11 presents the functional block diagram of PWCISHD. This detectordiscriminates between a background that appears through shadow/highlightversus that obscured by an object, through a distance that is avariation of the known Kulback-Leibler directed divergence.

As depicted in FIG. 11, a dissimilarity distance—1119—forms the outputof this detector. which in turn is derived from the divergences of prelative to q and q relative to p where p represents the densityassociated with the prevailing background and q is that due to thesmoothed incident image, with the area of interest being confined to therespective local aperture and the sampling points being dictated by thesolidified foreground acting as mask 709B.

The steps leading to computation of density p comprise constructing thehistogram of the gradient orientation image of the prevailing background709A_b—with the local aperture confining the area of interest andforeground pixels identifying the sampling points—through step 1102 andthen smoothing thus found histogram through step 1104 and normalizingthe smoothed histogram through step 1106. Similarly, through anidentical sequence of steps a density q is derived from the gradientorientation of the smoothed incident image. Once p and q are at hand tworelative divergences D(p,q) and D(q,p) are computed as follows throughsteps 1108 and 1110 of FIG. 11.

$\begin{matrix}{{D( {p,q} )} = {\sum{p\;{\log_{2}( \frac{p}{q} )}}}} \\{{D( {q,p} )} = {\sum{q\;{\log_{2}( \frac{q}{p} )}}}}\end{matrix}$Once the above relative distances are determined, the following distanceis computed through step 1112 to quantify dissimilarity between theprevailing background and the test image within the local aperture ofconcern:D _(PWCISHD)=max[|D(p,q)|,|D(q,p)|]PWCSSHD

FIG. 12 presents the functional block diagram of PWCSSHD. This detectormuch like the one before—i.e. PWCISHD—discriminates between a backgroundthat appears through shadow/highlight versus that obscured by an objectusing a distance described below.

Referring to FIG. 12, through step 1200 a histogram of gradientorientation differentials, Δθ, is constructed according to:Δθ=min(|θ₂−θ₁|,2Π−|θ₂−θ₁|)where

θ₁=gradient orientatio n at a given point of the prevailing background

and

θ₂=gradient orientatio n at the same given coordinate s as above of thetest image

with the proviso that when Δθ>0 and either θ₁ or θ₂ remain undefined,then

Δθ=a pre-assigned penalty differential. Such situations arise when thegradient magnitude at the image point of concern descends below a levelto warrant computing gradient orientation, as discussed earlier. Thehistogram bins start at bin 0 and assume a bin size equal to that of thegranularity with which gradient orientation is computed for data inputs709A and 709A_b.Ultimately, through step 1202, a dissimilarity distance is computedaccording to:

$D_{PWCSSHD} = {\frac{\text{Disagrrement}}{\text{Agreement}} = \frac{\sum\limits_{k = 1}^{K}{b_{k} \cdot {bw}_{k} \cdot f_{k}}}{f_{0}}}$where b_(k) h=bin number k

bw_(k)=bin width

f_(k)=frequency at bin number k

Counting vehicles in presence of moving shadow/highlight is at timesaccompanied by fill-ratios indicative of consistent Full states. Suchinstances are unraveled through expecting a minimum count of consecutiveshadow/highlight plus a minimum number of non-shadow/non-highlightframes followed by minimum number of shadow/highlight frames.

Motion Detection & Speed Estimation

Several motion detection algorithms are in play in the presentinvention. Some are applied selectively based on the state for whichfill-ratio qualifies for and some others are used in differentembodiments of the present invention. Below they are addressed incontext of states of row-sum processing

-   -   Motion detectors applied at Growing & Receding states;    -   Motion detectors applied at Full state        Motion Detectors Applied at Growing & Receding States

In these states the centroid of the foreground pixels within the localaperture as seen through the row-sum vector is computed, according to

${ci}_{0} = \frac{\sum\limits_{i = 1}^{m}{rs}_{i}}{m}$

with

-   -   rs_(i) representing the ith element of {right arrow over (RS)}.

and

-   -   ci₀ representing said centroid coordinate (or centroid-index)        only along the height of local aperture.        As evident from above, in this instance the interest is confined        to only how far the centroid has advanced or receded along the        height of the local aperture as opposed to movement along its        width.

The above centroid-index is computed for the prior and current frames aslong as their fill-ratio qualifies for the same states of Growing orReceding. A centroid-index differential is computed according to:Δ(ci ₀)=(ci ₀)−(ci ₀)_(t-1)

-   -   where suffix t represents the current frame and t−1 the prior        frame.        Thus found value of Δ(ci₀) is averaged recursively to yield a        mean—μΔ(ci₀)—and the result is used to establish direction of        movement and in turn, in conjunction with fill-ratio,        disambiguates or dictates state transition when warranted. More        specifically a negative μΔ(ci₀) is viewed to be due to an object        moving in the opposite direction and hence is cause enough to        force a local aperture reset.        Motion Detectors Applied at Full State

Several motion detectors are disclosed in the present invention, in thiscategory. Basically they exploit similarity between:

-   -   i) the smoothed image pair in the current and prior frame within        the local aperture of concern, where warranted by a mask—to be        described;    -   ii) the gradient orientation image pair in the current and prior        frame within the local aperture of concern, where warranted by        the same mask as in (i), above;    -   iii) the vertical gradient image pair in the current and prior        frame within the local aperture of concern, where warranted by        the same mask as in (i), above.

It is emphasized that the present invention adheres to the convention ofviewing the direction of an edge element as being perpendicular to theedge itself and pointing to the side with higher intensity.

Mask Generation

Said mask in (i), above, is a binary image and, as illustrated in FIG.13, is derived through the process of:

-   -   6) Constructing a histogram of the modulus of the value of the        vertical gradient image pixels, for the region of interest;    -   7) Deriving a stable maximum for said histogram in (1), above,        by computing the median of the samples which fall within a top        predefined percentage of the population;    -   8) Deriving a trimmed mean for said histogram by ignoring a        bottom low and high top predefined percentages of the underlying        samples of the population;    -   9) Deriving a threshold from the mean of thus derived stable        maximum and trimmed mean in (2) and (3) above;    -   10) If thus derived threshold in (4), above, descends below a        user-defined noise floor, then raising said threshold in such a        way to trump out any said value of the vertical gradient image        pixel from exceeding said raised threshold;    -   11) Comparing the modulus of said vertical gradient image pixels        with thus found threshold in steps (4) and (5) above, and when        the value exceeds said threshold, set the corresponding pixel in        a so called mask image otherwise clear that pixel coordinate,        and in this fashion obtain the mask delineating the image        coordinates of concern.

As mentioned earlier several motion detectors in this category aredisclosed in the present invention. All of them share the known trait inwhich the similarity between an image pair or some variation of an imagepair with one being due to the prior frame and the other due to thecurrent frame is exploited at different shifts—i.e.displacements—between them along the height of the respective localaperture—i.e. in one axis. The novel aspect of the methods presentedherein rests either in the way the subset of points from each image ofthe image pair are selected for participation in saidsimilarity/dissimilarity determination effort or the metric or methodused in quantifying similarity or dissimilarity. It should be rememberedthat the operations involved here are all confined to the local apertureof concern.

In the preferred embodiment masks are constructed for the prior andcurrent smooth images, as described above and depicted in FIG. 13. Thecurrent smooth image and its associated mask are shifted incrementally,over a range that covers expected positive and negative shifts betweenthe two image pairs, and at each increment the grayscales of thecorresponding points of the prior and current smoothed images aresubjected to a normalized correlation operation subject to beingsanctioned by both of their masks, as depicted in FIG. 14. Said twomasks are AND-ed to yield the mask which identifies the participatingpoints.

The normalized correlation operation at each incremental shift yields acorrelation coefficient ρ(k) where k denotes the shift along the heightof the aperture. Said correlation coefficient has range of −1 to +1,however, for all intents and purposes it can be low-clipped at 0, namelysubjected to max[0,ρ(k)] operation, as depicted in FIG. 14. ρ(k) isviewed as confidence in the associated shift between prior and currentframe smoothed grayscale images. FIG. 14 depicts the various stages atextracting the desired shift. Hence, in this fashion the inter-frameshift in pixels during non-shadow/highlight Full states where each shiftis accompanied by a confidence, a weighted mean for the resulting shiftsassociated with each frame is computed with the confidences acting asthe weights according to:

$k_{o} = \frac{\sum\limits_{f = 1}^{F}{\rho_{f} \cdot k_{f}}}{\sum\limits_{f = 1}^{F}\rho_{f}}$where k₀ denotes the weighted mean of attained shifts associated with anapparent passing object, hereafter termed the aggregate shift and k_(f)denotes the shift associated with frame f and ρ_(f) denotes theconfidence associated with said shift k_(f).

FIG. 15 depicts yet another method of detecting the shifts between theprior and current frame. In this instance the image pair, instead ofbeing the smoothed image pair are the gradient orientation image pair ofthe previous and current frame. The same masks as before, i.e. thoseshown in FIG. 14, are used in conjunction with their respective gradientorientation image, however, instead of the earlier used normalizedcorrelation scheme, the least divergent or least distant image pairs,with the distance being computed as shown and described through step1202 of FIG. 12. The steps are also depicted in FIG. 15.

A similar aggregate shift to k₀, above, is computed for the resultantinter-frame-based shifts by computing the median of all the resultantshifts for the frames encountered in the course of the respective localaperture processing.

In yet another embodiment of the present invention the shift betweencurrent and prior frame is measured much like that depicted in FIG. 15with the exception of the gradient orientation images giving their placeto the vertical gradient images.

Validation

As evident from FIG. 10, when column-sum and row-sum processing concludein favor of incrementing the vehicle count a validation step, 802 isentered. In the course of validation the object length is computed andwhen lesser than the minimal expected value for a vehicle, the currentaperture is reset otherwise a speed is estimated to accompany the signalto increment the vehicle count. Again as evident from FIG. 10,incrementing the vehicle count is followed by resetting all apertures.The processing that yields the object-length and estimates speedproceeds as follows:

$( \text{frames} )_{total} = {{{2.\min\lfloor {( \text{frames} )_{Growing},( \text{frames} )_{Receding}} \rfloor} + {( \text{frames} )_{Full}({objectlength})}} = {( {\text{frames}} )_{total} \cdot \frac{k_{o}}{m} \cdot ({Ap})_{h}}}$Where k₀ is the aggregate shift yielded by any of the motion detectionschemes described earlier and depicted in FIG. 14 or 15 and is in pixelsper frame and m is the aperture height in pixels and (Ap)_(h) is theaperture height in unit length.

Vehicle speed is estimated through:

${speed} = \frac{( \text{object length} ).( \text{frame rate} )}{( \text{frames} )_{total}}$

1. A method for counting multiple passing vehicles in transition zonesor entrances or exits of a multi-story carpark in a given directionalong a two-lane two-way traffic road beneath a low clearance ceiling ofthe carpark, the method comprising: providing a video camera forproducing a video stream, the video camera including a wide anglerectilinear lens forming a pyramidal view volume of the video camera,the pyramidal view volume having a field of view and four outer faces;locating the video camera at the ceiling above a road side edge so as toimage the road across the field of view and align one of the faces ofthe pyramidal view volume parallel to the road side edge andperpendicular to the road; processing the video stream to model aprevailing background model of the road in the field of view; defining arectangular monitor zone extending across the road; deriving a smoothedincident image for the rectangular monitor zone; and performingdirectional gradient processing on the smoothed incident image toproduce a foreground image, comprising the steps of: convolving thesmoothed incident image with Sobel horizontal and vertical kernels toproduce horizontal and vertical gradient images, respectively; computinga gradient magnitude image from the horizontal and vertical gradientimages; computing an adaptive suppression threshold for suppressingnoise in the gradient magnitude image; comparing the smoothed incidentimage to the prevailing background model on a pixel-by-pixel basis; andproducing the foreground image in response to determining a gradientorientation conformance between the smoothed incident image and theprevailing background model and in response to determining an intensitydifferential between the smoothed incident image and the prevailingbackground model; deriving a motion direction from a temporal change inthe foreground image; and altering a vehicle count in response toderiving a motion direction.
 2. The method of claim 1, wherein the stepof deriving a smoothed incident image for the rectangular monitor zoneincludes low pass filtering the video stream with a Gaussian pointspread function.
 3. The method of claim 1, wherein: the smoothedincident image consists of pixels; and the step of deriving a smoothedincident image for the rectangular monitor zone comprises low passfiltering each of the pixels of the smoothed incident image with aGaussian point spread function.
 4. The method of claim 3, wherein thestep of performing directional gradient processing on the smoothedincident image to produce a foreground image includes performingdirectional gradient processing on each of the pixels of the smoothedincident image.
 5. A method for counting multiple passing vehicles intransition zones or entrances or exits of a multi-story carpark in agiven direction along a two-lane two-way traffic road beneath alow-clearance ceiling of the carpark, the method comprising: providing avideo camera for producing a video stream, the video camera including awide angle rectilinear lens forming a pyramidal view volume of the videocamera, the pyramidal view volume having a field of view and four outerfaces; locating the video camera at the ceiling above a road side edgeso as to image the road across the field of view and align one of thefaces of the pyramidal view volume parallel to the road side edge andperpendicular to the road; processing the video stream to model aprevailing background model of the road in the field of view; processingthe video stream to update the prevailing background model of the roadso as to reveal a foreground image, comprising the steps of: deriving asmoothed incident image; comparing the smoothed incident image to theprevailing background model on a pixel-by-pixel basis; and updating apixel of the prevailing background model with a pixel of the smoothedincident image to reveal the foreground image, in response to the pixelof the prevailing background model differing from the pixel of thesmoothed incident image by a threshold; wherein the threshold isdependent on a difference between a gradient orientation of the pixel ofsmoothed incident image and a gradient orientation of the pixel of theprevailing background model; deriving a motion direction from a temporalchange in the foreground image; and altering a vehicle count in responseto deriving a motion direction.
 6. The method of claim 5, wherein thestep of processing the video stream to update the prevailing backgroundmodel of the road so as to reveal a foreground image further comprisesthe steps of: defining a rectangular monitor zone extending across theroad; and deriving the smoothed incident image at the rectangularmonitor zone.
 7. The method of claim 6, wherein the step of deriving thesmoothed incident image at the rectangular monitor zone includes lowpass filtering the video stream with a Gaussian point spread function.8. The method of claim 6, wherein: the smoothed incident image consistsof pixels; and the step of deriving the smoothed incident image at therectangular monitor zone comprises low pass filtering each of the pixelsof the smoothed incident image with a Gaussian point spread function. 9.The method of claim 5, further comprising relaxing the threshold inresponse to conformity between the gradient orientations of the pixelsof the smoothed incident image and the prevailing background model. 10.The method of claim 5, further comprising making the threshold stringentin response to non-conformity between the gradient orientations of thepixels of the smoothed incident image and the prevailing backgroundmodel.